#include "opencv2\opencv.hpp"
#include "cmd_utility.h"
#include <iostream>
#include <sstream>
using namespace std;

int main(int argc, char** argv) {
	// Parsing the command line
	CommandLineArgument cmdline_arg;
	if (!cmdline_arg.ParseCommandLineArgument(argc, argv)) {
		cout << "parsing commandline fail!\n";
		exit(-1);
	}

	// Load the image
	ostringstream filename;
	filename << cmdline_arg.grid_ << 0 << ".png";
	IplImage* img = cvLoadImage(filename.str().c_str());
	if (img == NULL) {
		cout << "Load image fail!\n";
		exit(-1);
	}

	// Create a named window
	cvNamedWindow("SVM-Classifier");

	// Show the image in the named window
	cvShowImage("SVM-Classifier", img);

	while (1) {
		if (cvWaitKey(100) == 27)
			break;
	}

	// Clean up
	cvDestroyWindow("SVM-Classifier");
	cvReleaseImage(&img);

	return 0;	
}